﻿using Dapper;
using DapperExtensions;
using MaximServices.Data;
using MaximServices.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MaximServices.Repository
{
    public class DateDetailRepository
    {
        private readonly DataBaseRepository _dbrsp;

        public DateDetailRepository(DataBaseRepository dbrsp)
        {
            _dbrsp = dbrsp;
        }

        public void Dispose()
        {
            _dbrsp.Database.Dispose();
        }
        /// <summary>
        /// 获取所有包含参数日期的数据
        /// </summary>
        /// <param name="dates"></param>
        /// <returns></returns>
        public List<DateDetail> GetList(List<string> dates)
        {
            string sql = $"select id,rule_id,target_date from date_detail where target_date in ({string.Join(',', dates)})";
            List<DateDetail> result = _dbrsp.Database.Connection.Query<DateDetail>(sql).ToList();
            return result;
        }
    }
}
